import os
import sys

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
from utils.toml import load_mysql_config
from dao.orm import DBManager

mysql_config = load_mysql_config("./config/config.toml")

db = DBManager(
    mysql_config["host"],
    mysql_config["user"],
    mysql_config["password"],
    mysql_config["database"]
)

class classOrm:
    def __init__(self):
        self.db = db
    
    def get_class(self):
        '''
            获取全部班级信息
            return: 返回一个包含全部班级信息的数组
        '''
        result = self.db.fetchall("select * from class_info")
        return result